package com.springboot.cloud.demos.feign.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.param.MemberCardQueryParam;
import com.springboot.cloud.demos.feign.service.MemberCardService;
import com.springboot.cloud.demos.feign.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class MemberCardController {

    @Autowired
    private MemberCardService memberCardService;
    @Autowired
    private UnitService unitService;

    @GetMapping("/open/memberCard")
    public Result list(String type) {
        MemberCardQueryParam params = new MemberCardQueryParam();
        params.setDeleted("N");
        params.setType(type);
        return memberCardService.conditions(params);
    }

    @RequestMapping(value = "/open/memberCard/{memberCardId}", method = RequestMethod.GET)
    public Result memberCard(@PathVariable(value = "memberCardId") String memberCardId) {
        return memberCardService.memberCard(memberCardId);
    }

    @RequestMapping(value = "/open/memberCard/{memberCardId}/unit", method = RequestMethod.GET)
    public Result unit(@PathVariable String memberCardId) {
        return unitService.unit(memberCardId);
    }

}
